<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ include file="../common.jsp"%>
<%@ page import="org.springside.core.Constants"%>
<%@ page import="java.sql.*,javax.sql.DataSource"%> 
<%@ page import="cn.firstsoft.firstframe.admin.*"%> 
<%@ page import="javax.naming.*,javax.naming.directory.*"%> 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>管理控制台 - 服务信息</title>
<%@ include file="/common/meta2.jsp"%>
<link href="../style.css" type="text/css" rel=stylesheet>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="#FFFFFF">
<script language="javascript">
  function modifyStatus(id,cron){
    cronText  = document.getElementById(cron);

    document.module.moduleID.value = id;
    document.module.statusValue.value = cronText.value;

    document.module.submit();
  }

</script>
<FORM name="module" method="post" action="module_update.jsp">
<INPUT type="hidden" name="moduleID" value="">
<INPUT type="hidden" name="statusValue" value="">
</FORM>

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
	<TR>
		<TD class=listViewPaginationTdS1 colSpan=20>
		模块管理
		</TD>
	</TR>
	<TR>
		<TD class=listViewPaginationTdS1 width="5%">
		ID
		</TD>
		<TD class=listViewPaginationTdS1 width="10%">
		模块名称
		</TD>
		<TD class=listViewPaginationTdS1 width="10%">
		模块路径
		</TD>
		<TD class=listViewPaginationTdS1 width="55%">
		URL
		</TD>
		<TD class=listViewPaginationTdS1 width="5%">
		状态

		</TD>
		<TD class=listViewPaginationTdS1  width="15%">
		描述
		</TD>
	</TR>
<%

Context   ctx   =   new   InitialContext();   
DataSource   ds   =   (DataSource)   ctx.lookup(PropertyFile.readValue("jdbc.properties","jndi.default_name"));   

Connection conn=  ds.getConnection(); 

Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);   
String sql="select id,label_id,name,path,icon,url,target,pos,isdisplay,descn from system_modules";   
ResultSet rs=stmt.executeQuery(sql); 
 int i = 0;
while(rs.next()) {
 i++;
 //String bgcolor = (i%2==0)?"bgcolor=red":"" tabDetailViewDL
%>   
    <TR >
		<TD class=tabDetailViewDF>
		<%=rs.getString("id")%>
		</TD>
		<TD class=tabDetailViewDF>
		<%=rs.getString("name")%>
		</TD>
		<TD class=tabDetailViewDF>
		<%=rs.getString("path")%>
		</TD>
		<TD class=tabDetailViewDF>
		<%=rs.getString("url")%>
		</TD>
		<TD class=tabDetailViewDF>
		<select name="isdisplay_<%=rs.getString("id")%>" onchange="modifyStatus('<%=rs.getString("id")%>','isdisplay_<%=rs.getString("id")%>');">
            <option value="0" <% if ("0".equals(rs.getString("isdisplay"))) out.println("selected"); %>>隐藏</option>
            <option value="1" <% if ("1".equals(rs.getString("isdisplay"))) out.println("selected"); %>>启用</option>
            <option value="2" <% if ("2".equals(rs.getString("isdisplay"))) out.println("selected"); %>>屏蔽</option>
          </select>
		</TD>
		<TD class=tabDetailViewDF>
		<%=rs.getString("descn")%>
		</TD>
	</TR>
<%}
rs.close();   
stmt.close();   
conn.close();   
%>   
  </TBODY>
</TABLE>
</body>
</html>